home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / tex / inputs / cd.sty < prev    next >
Text File  |  1991-05-20  |  6KB  |  140 lines

  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Cut Here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % cd.sty - Commutative diagram macros modified from AmSTeX  3-Mar-89
  3. % Intended as a LaTeX style file.  Darrel Hankerson  (Bitnet: hank@auducvax)
  4.  
  5. %\catcode`\@=11
  6. \def\ssize{\scriptstyle}
  7. \newdimen\ex@
  8. \ex@.2326ex
  9.  
  10. \def\vspace@{\def\vspace##1{\noalign{\vskip##1\relax}}}
  11. \def\Let@{\relax\iffalse{\fi\let\\=\cr\iffalse}\fi}
  12.  
  13. \let\ampersand@\relax
  14. \newdimen\bigaw@
  15. \newdimen\minaw@
  16. \minaw@11.11128\ex@
  17. \newdimen\minCDaw@
  18. \minCDaw@2.5pc
  19. \newif\ifCD@
  20. \def\minCDarrowwidth#1{\relax\ifmmode\ifinner\onlydmatherr@\minCDarrowwidth
  21.  \else\minCDaw@#1\relax\fi\else\onlydmatherr@\minCDarrowwidth\fi}
  22. \def\CD{\bgroup\catcode`\@=\active %\catcode added for LaTeX
  23.  \vspace@\relax\iffalse{\fi\let\ampersand@&\iffalse}\fi
  24.  \CD@true\vcenter\bgroup\Let@\tabskip\z@skip\baselineskip20\ex@
  25.  \lineskip3\ex@\lineskiplimit3\ex@\halign\bgroup
  26.  &\hfill$\m@th##$\hfill\cr}
  27. \def\endCD{\cr\egroup\egroup\egroup}
  28. \def\cd#1{\csname cd\string#1\endcsname}
  29. \def\cddef#1{\expandafter\def\csname cd\string#1\endcsname}
  30. \cddef.{\relax\ifmmode&&\else\leavevmode.\spacefactor3000 \fi}
  31. \cddef\rightarrow#1#2{\harrow@{#1}{#2}\rightarrowfill} \cddef>{\cd\rightarrow}
  32. \cddef\leftarrow#1#2{\harrow@{#1}{#2}\leftarrowfill} \cddef<{\cd\leftarrow}
  33. \def\harrow@#1#2#3{\ampersand@\setbox\z@\hbox{$\ssize
  34.  \;\;{#1}\;$}\setbox\@ne\hbox{$\ssize\;\;{#2}\;$}\setbox\tw@
  35.  \hbox{$#2$}\ifCD@
  36.  \global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
  37.  \ifdim\wd\z@>\bigaw@\global\bigaw@\wd\z@\fi
  38.  \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi
  39.  \ifCD@\hskip.5em\fi
  40.  \ifdim\wd\tw@>\z@
  41.  \mathrel{\mathop{\hbox to\bigaw@{#3}}\limits^{#1}_{#2}}\else
  42.  \mathrel{\mathop{\hbox to\bigaw@{#3}}\limits^{#1}}\fi
  43.  \ifCD@\hskip.5em\fi\ampersand@}
  44. \cddef\uparrow#1#2{\llap{$\vcenter{\hbox
  45.  {$\ssize#1$}}$}\Big\uparrow\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  46. \cddef\downarrow#1#2{\llap{$\vcenter{\hbox
  47.  {$\ssize#1$}}$}\Big\downarrow\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  48. \cddef=#1#2{\ampersand@\setbox\z@\hbox{$\ssize
  49.  \;{#1}\;\;$}\setbox\@ne\hbox{$\ssize\;{#2}\;\;$}\setbox\tw@
  50.  \hbox{$#2$}\ifCD@
  51.  \global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
  52.  \ifdim\wd\z@>\bigaw@\global\bigaw@\wd\z@\fi
  53.  \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi
  54.  \ifCD@\hskip.5em\fi
  55.  \ifdim\wd\tw@>\z@
  56.  \mathrel{\mathop{\vbox{\hrule width\bigaw@\vskip3\ex@\hrule width
  57.  \bigaw@}}\limits^{#1}_{#2}}\else
  58.  \mathrel{\mathop{\vbox{\hrule width\bigaw@\vskip3\ex@\hrule width
  59.  \bigaw@}}\limits^{#1}}\fi
  60.  \ifCD@\hskip.5em\fi\ampersand@}
  61. \cddef|#1#2{\llap{$\vcenter{\hbox
  62.  {$\ssize#1$}}$}\Big\vert\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  63. \cddef\|#1#2{\llap{$\vcenter{\hbox
  64.  {$\ssize#1$}}$}\Big\vert\Big\vert\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  65. \def\pretend#1\haswidth#2{\setbox\z@\hbox{$\scriptstyle{#2}$}\hbox
  66.  to\wd\z@{\hfill$\scriptstyle{#1}$\hfill}}
  67. \cddef\updownarrows#1#2{\llap{$\vcenter{\hbox{$\ssize#1$}}$}
  68.  \Big\uparrow\Big\downarrow\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  69. \cddef\downuparrows#1#2{\llap{$\vcenter{\hbox{$\ssize#1$}}$}
  70.  \Big\downarrow\Big\uparrow\rlap{$\vcenter{\hbox{$\ssize#2$}}$}&&}
  71. \cddef\rightleftarrows#1#2{\harrows@{#1}{#2}\rightarrowfill\leftarrowfill}
  72. \cddef\leftrightarrows#1#2{\harrows@{#1}{#2}\leftarrowfill\rightarrowfill}
  73. \def\harrows@#1#2#3#4{\ampersand@\setbox\z@\hbox{$\ssize
  74.  \;{#1}\;\;$}\setbox\@ne\hbox{$\ssize\;{#2}\;\;$}\setbox\tw@
  75.  \hbox{$#2$}\ifCD@
  76.  \global\bigaw@\minCDaw@\else\global\bigaw@\minaw@\fi
  77.  \ifdim\wd\z@>\bigaw@\global\bigaw@\wd\z@\fi
  78.  \ifdim\wd\@ne>\bigaw@\global\bigaw@\wd\@ne\fi
  79.  \ifCD@\hskip.5em\fi
  80.  \ifdim\wd\tw@>\z@
  81.  \mathrel{\mathop{\harrowsfill@#3#4}\limits^{#1}_{#2}}\else
  82.  \mathrel{\mathop{\harrowsfill@#3#4}\limits^{#1}}\fi
  83.  \ifCD@\hskip.5em\fi\ampersand@}
  84. \def\harrowsfill@#1#2{\stackrel{\raisebox{0pt}[2\ex@][0pt]{\hbox
  85.  to\bigaw@{#1}}}{\raisebox{-1\ex@}[0pt][0pt]{\hbox to \bigaw@{#2}}}}
  86. %\endinput  % End here if AmSTeX @-syntax not needed.
  87.  
  88. %%%%%  The following code adds the AmSTeX @-syntax  %%%%%
  89. %\newlinechar=`\^^J
  90. \def\err@#1{\errmessage{AmS-TeX error: #1}}
  91. \newhelp\athelp@
  92. {Only certain combinations beginning with @ make sense to me.^^J
  93. Perhaps you wanted \string\@\space for a printed @?^^J
  94. I've ignored the character or group after @.}
  95. \def\futureletnextat@{\futurelet\next\at@}
  96. {\catcode`\@=\active
  97. \lccode`\Z=`\@ \lccode`\I=`\I \lowercase
  98. {\gdef@{\expandafter\csname futureletnextatZ\endcsname}\expandafter
  99.  \gdef\csname atZ\endcsname
  100.  {\ifcat\noexpand\next a\def\next{\csname atZZ\endcsname}\else
  101.  \ifcat\noexpand\next0\def\next{\csname atZZ\endcsname}\else
  102.  \ifcat\noexpand\next\relax\def\next{\csname atZZZ\endcsname}\else
  103.  \def\next{\csname atZZZZ\endcsname}\fi\fi\fi\next}
  104. \expandafter\gdef\csname atZZ\endcsname#1{\expandafter
  105.  \ifx\csname #1Zat\endcsname\relax\def\next
  106.  {\errhelp\expandafter=\csname athelpZ\endcsname
  107.  \csname errZ\endcsname{Invalid use of \string@}}\else
  108.  \def\next{\csname #1Zat\endcsname}\fi\next}
  109. \expandafter\gdef\csname atZZZ\endcsname#1{\expandafter
  110.  \ifx\csname \string#1ZZat\endcsname\relax\def\next
  111.  {\errhelp\expandafter=\csname athelpZ\endcsname
  112.  \csname errZ\endcsname{Invalid use of \string@}}\else
  113.  \def\next{\csname \string#1ZZat\endcsname}\fi\next}
  114. \expandafter\gdef\csname atZZZZ\endcsname#1{\errhelp
  115.  \expandafter=\csname athelpZ\endcsname
  116.  \csname errZ\endcsname{Invalid use of \string@}}}}
  117. \def\atdef@#1{\expandafter\def\csname #1@at\endcsname}
  118. \def\atdef@@#1{\expandafter\def\csname \string#1@@at\endcsname}
  119. \newhelp\defahelp@{If you typed \string\define\space cs instead of
  120. \string\define\string\cs\space^^J
  121. I've substituted an inaccessible control sequence so that your^^J
  122. definition will be completed without mixing me up too badly.^^J
  123. If you typed \string\define{\string\cs} the inaccessible control sequence^^J
  124. was defined to be \string\cs, and the rest of your^^J
  125. definition appears as input.}
  126. \newhelp\defbhelp@{I've ignored your definition, because it might^^J
  127. conflict with other uses that are important to me.}
  128. \atdef@.{\cd.}  % AmSTeX @-format
  129. \atdef@>#1>#2>{\cd\rightarrow{#1}{#2}}
  130. \atdef@<#1<#2<{\cd\leftarrow{#1}{#2}}
  131. \atdef@ A#1A#2A{\cd\uparrow{#1}{#2}}
  132. \atdef@ V#1V#2V{\cd\downarrow{#1}{#2}}
  133. \atdef@|{\Big\Vert&&}
  134. \atdef@@\vert{\Big\Vert&&}
  135. \atdef@={&\hskip.5em\mathrel
  136.  {\vbox{\hrule width\minCDaw@\vskip3\ex@\hrule width
  137.  \minCDaw@}}\hskip.5em&}
  138. %\catcode`\@=\active
  139. \endinput
  140.